<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display: none;"></div>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );

	echo( form_open(base_url() . 'index.php/new_member_sign_up/step3_process/', array('id' => 'newMemberStep3Form') ) );

		Form::OpenFormItem('Child First Name*:', 260);
			echo( form_input(array('name'=>'firstName','id'=>'firstName','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Child Last Name*:', 260);
			echo( form_input(array('name'=>'lastName','id'=>'lastName','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Child Gender*:', 260);
			$genderOptions = array(''=>'Select','male'=>'Male','female'=>'Female');
			echo( form_dropdown('gender', $genderOptions, '', 'id="gender" style="width: 100px;" ') );
		Form::CloseFormItem();
		
		Spacer::Render(0, 15);
		
		Form::OpenFormItem('Child Primary Email:', 260);
			echo( form_input(array('name'=>'primaryEmail','id'=>'primaryEmail','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Child Home Phone Number:', 260);
			echo( form_input(array('name'=>'homePhoneNumber','id'=>'homePhoneNumber','style'=>'width: 250px;')) );
		Form::CloseFormItem();
		Form::OpenFormItem('Child Birth Date*:', 260);
			echo( form_input(array('name'=>'birthDate','id'=>'birthDate','style'=>'width: 150px;','onfocus'=>'datePickerController.show(\'birthDate\');','onclick'=>'datePickerController.show(\'birthDate\');', 'onblur'=>'datePickerController.hide(\'birthDate\');')) );
			echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"birthDate":"m-sl-d-sl-Y"} } );</script>' );
		Form::CloseFormItem();
		Form::OpenFormItem('Grade*:', 260);
			$gradeOptions = array(''=>'Select','K'=>'K','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12');
			echo( form_dropdown('grade', $gradeOptions, '', 'id="grade" style="width: 150px;" ') );
		Form::CloseFormItem();
		
		Spacer::Render(0, 15);
		
		Form::OpenFormItem('Center for Balvihar*:', 260);
			$centerForBalviharOptions = array(''=>'Select','Andover'=>'Andover','MetroWest'=>'MetroWest');
			echo( form_dropdown('centerForBalvihar', $centerForBalviharOptions, '', 'id="centerForBalvihar" style="width: 150px;" ') );
		Form::CloseFormItem();
		Form::OpenFormItem('Balvihar Session:', 260);
			$balviharSessionOptions = array(''=>'Select','Morning'=>'Morning','Afternoon'=>'Afternoon');
			echo( form_dropdown('balviharSession', $balviharSessionOptions, '', 'id="balviharSession" style="width: 150px;" ') );
		Form::CloseFormItem();
		Form::OpenFormItem('Attend Language Classes?', 260);
			echo(  form_radio('attendLanguageClasses', 'yes', true, 'id="attendLanguageClassesYes"') . form_label('Yes', 'attendLanguageClassesYes') . '&nbsp;&nbsp;' );
			echo(  form_radio('attendLanguageClasses', 'no', false, 'id="attendLanguageClassesNo"') . form_label('No', 'attendLanguageClassesNo') );
		Form::CloseFormItem();
		Form::OpenFormItem('What Language?*:', 260);
			$languageOptions = array(''=>'Select','Hindi'=>'Hindi','Kannada'=>'Kannada','Malayalam'=>'Malayalam','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
			echo( form_dropdown('language', $languageOptions, '', 'id="language" style="width: 150px;" ') );
		Form::CloseFormItem();
		Form::OpenFormItem('Which Language Session*:', 260);
			$languageSessionOptions = array(''=>'Select','Morning'=>'Morning','Afternoon'=>'Afternoon');
			echo( form_dropdown('languageSession', $languageSessionOptions, '', 'id="languageSession" style="width: 150px;" ') );
		Form::CloseFormItem();
		Form::OpenFormItem('Attend Cultural Classes?', 260);
			echo(  form_radio('attendCulturalClasses', 'yes', true, 'id="attendCulturalClassesYes"') . form_label('Yes', 'attendCulturalClassesYes') . '&nbsp;&nbsp;' );
			echo(  form_radio('attendCulturalClasses', 'no', false, 'id="attendCulturalClassesNo"') . form_label('No', 'attendCulturalClassesNo') );
		Form::CloseFormItem();
	
	echo( form_close() );
	
?>
	
	<div class="form-button-container">
		<a href="javascript: populate();">Populate</a>
		<a href="javascript: validate();"><img src="<?php echo( base_url() );?>assets/images/buttons/next_off.gif" border="0" onmouseover="this.src = '<?php echo( base_url() );?>assets/images/buttons/next_over.gif';" onmousedown="this.src = '<?php echo( base_url() );?>assets/images/buttons/next_on.gif';" onmouseup="this.src = '<?php echo( base_url() );?>assets/images/buttons/next_off.gif';" onmouseout="this.src = '<?php echo( base_url() );?>assets/images/buttons/next_off.gif';" /></a>
	</div>

</div>


<script type="text/javascript">
	function validate()
	{
		new Ajax.Request(baseUrl + 'index.php/new_member_sign_up_validation/validate_step3/', 
		{
			method:'post',
			parameters: Form.serialize( $('newMemberStep3Form') ),
		  	onSuccess: function(response)
			{
				var result = response.responseText;
				
				if( result == 'VALIDATION_SUCCESS' )
				{
					$('newMemberStep3Form').submit();
				}
				else
				{
					$('validationErrors').innerHTML = result;
					$('validationErrors').show();
					Effect.ScrollTo('validationErrors', { duration:'0.2', offset:-20 });
				}
			},
			onFailure: function(){ alert('failed') }
		});
	}
	
	
	function populate()
	{
		$('firstName').value = 'John'
		$('lastName').value = 'Doe Jr'
		$('gender').selectedIndex = 1;
		$('primaryEmail').value = 'john.doe.jr@email.com';
		$('homePhoneNumber').value = '555-555-5555';
		$('birthDate').value = '04/22/1997';
		$('grade').selectedIndex = 7;
		$('centerForBalvihar').selectedIndex = 1;
		$('balviharSession').selectedIndex = 1;
		$('language').selectedIndex = 1;
		$('languageSession').selectedIndex = 1;
	}
</script>